package com.scu.baseline.service.impl;


import com.scu.baseline.mapper.Departmentmapper;
import com.scu.baseline.pojo.Department;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (Department)表服务实现类
 *
 * @author AlonBurukeses
 * @since 2022-06-23 09:14:30
 */
@Service("departmentService")
public class DepartmentServiceImpl  {
    @Resource
    private Departmentmapper departmentmapper;
    public List<Department> selectall(){
        return this.departmentmapper.selectall();
    }
    public List<Department> selectByPage(Integer page){

        int tableCount = this.departmentmapper.count();
        int pageCount = (tableCount - 1) / 10 + 1;
        int index = (page - 1) * 10;
        return this.departmentmapper.selectByPage(index);
    }

    public List<Department> selectByName(String departmentName){
        return this.departmentmapper.selectByName(departmentName);
    }
    public void insertbymap(Map map){
        this.departmentmapper.insertbymap(map);
    }
    public void updatebymap(Map map){
        this.departmentmapper.updatebymap(map);
    }
    public void deleteById(Integer departmentId){
        this.departmentmapper.deleteById(departmentId);
    }
    public Integer count(){
        return this.departmentmapper.count();
    }

}

